<?php
namespace app\model;



class Group {


    static function update($data,$id){
        global $_G, $_P;
        if($id <= 0){
            return false;
        }
        return db_update (t_record, $data, array("id"=>$id) );
    }

    static function getGroupById($id) {
        if (empty($id)) {
            return false;
        }
        $sql = "SELECT * FROM " . tablename (t_record) . "
    									WHERE id = :id  and type = 0";
        $row = db_find($sql, array(":id"=>$id));
        return $row;
    }


    static function getPayedGroupById($id,$themeid) {
        if (empty($id) || empty($themeid)) {
            return false;
        }
        $sql = "SELECT * FROM " . tablename (t_record) . "
    									WHERE themeid =:themeid
    											and id = :id and status >= 1 and type = 0";
        $row = db_find($sql, array(":themeid"=>$themeid,":id"=>$id));
        return $row;
    }


}
